#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/9/28 16:00
# @Author  : AshJo
# @Desc    : udp服务端
# @Filename: server.py
# @Version : v1.0
"""

import socket

sk = socket.socket(type=socket.SOCK_DGRAM)
sk.bind(('127.0.0.1', 9000))

while True:
    msg, addr = sk.recvfrom(1024)
    print(msg.decode('utf-8'))
    send_msg = input('>>>').strip()
    sk.sendto(send_msg.encode('utf-8'), addr)
